From 0f38aee374029213a47ef7c29bd164093fe63c85 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Wed, 15 Nov 2023 12:24:42 +0100
Subject: refactor(hooks): remove useSettings hook

It does not make sense to re-export an existing object through a hook.
On some pages both the hook and the object was imported...
It is better to use the CONFIG (previously settings) object directly
and by doing it we avoid potential errors because of conditional hooks.
---
 src/pages/sujet/[slug].tsx | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

(limited to 'src/pages/sujet/[slug].tsx')

diff --git a/src/pages/sujet/[slug].tsx b/src/pages/sujet/[slug].tsx
index d841b73..a475df9 100644
--- a/src/pages/sujet/[slug].tsx
+++ b/src/pages/sujet/[slug].tsx
@@ -23,6 +23,7 @@ import {
 } from '../../services/graphql';
 import styles from '../../styles/pages/blog.module.scss';
 import type { NextPageWithLayout, PageLink, Topic } from '../../types';
+import { CONFIG } from '../../utils/config';
 import { ROUTES } from '../../utils/constants';
 import {
   getLinksItemData,
@@ -33,7 +34,7 @@ import {
   getWebPageSchema,
 } from '../../utils/helpers';
 import { loadTranslation, type Messages } from '../../utils/helpers/server';
-import { useBreadcrumb, useSettings } from '../../utils/hooks';
+import { useBreadcrumb } from '../../utils/hooks';
 
 export type TopicPageProps = {
   currentTopic: Topic;
@@ -116,11 +117,10 @@ const TopicPage: NextPageWithLayout<TopicPageProps> = ({
     (item): item is MetaItemData => !!item
   );
 
-  const { website } = useSettings();
   const { asPath } = useRouter();
   const webpageSchema = getWebPageSchema({
     description: seo.description,
-    locale: website.locales.default,
+    locale: CONFIG.locales.defaultLocale,
     slug: asPath,
     title: seo.title,
     updateDate: dates.update,
@@ -131,7 +131,7 @@ const TopicPage: NextPageWithLayout<TopicPageProps> = ({
     description: intro,
     id: 'topic',
     kind: 'page',
-    locale: website.locales.default,
+    locale: CONFIG.locales.defaultLocale,
     slug: asPath,
     title,
   });
@@ -155,7 +155,7 @@ const TopicPage: NextPageWithLayout<TopicPageProps> = ({
       {title}
     </>
   );
-  const pageUrl = `${website.url}${asPath}`;
+  const pageUrl = `${CONFIG.url}${asPath}`;
 
   return (
     <>
-- 
cgit v1.2.3

